package top.yzlin.jqueryjx3strategystation.entity.vo;

import lombok.Data;

@Data
public class ResponseVO {
    public static final ResponseVO SUCCESS = createInstance(200, "success");
    public static final ResponseVO NOT_FOUND = createInstance(404, "not found");

    private int status;
    private String message;
    private Object data;
    private Object error;

    public static ResponseVO createSuccessInstance(Object data) {
        return createInstance(200, "success", data, null);
    }

    public static ResponseVO createInstance(int status, String message) {
        return createInstance(status, message, null, null);
    }

    public static ResponseVO createInstance(int status, String message, Object data) {
        return createInstance(status, message, data, null);
    }

    public static ResponseVO createInstance(int status, String message, Object data, Object error) {
        ResponseVO responseVO = new ResponseVO();
        responseVO.setStatus(status);
        responseVO.setMessage(message);
        responseVO.setData(data);
        responseVO.setError(error);
        return responseVO;
    }
}
